<template>
	<!-- 选择就诊人selPerson -->
	<view class="content">
		请选择就诊人
		<view
			class="person"
			@click="go(item.id)"
			v-for="item in personList"
			:key="item.id"
		>
			<view class="left">
				<view class="data">
					<view class="name">{{item.name}}</view>
					<view class="tip" v-if="item.relationType==0">本人</view>
					<view class="tip" v-else>其他</view>
				</view>
				<text class="idcard">{{item.idcard}}</text>
			</view>
			<view class="right">
				<text class="identfy" v-if="item.id==id">默认就诊人</text>
				<text class="identfy" v-else="item.id==id"></text>
				</view>
			
		</view>
	</view>
</template>

<script setup>
import { reactive,onMounted, ref } from 'vue'
import {doctorSelPer} from '@/api/AppointmentRegisterAPI.js'
import { selPersonStore } from '@/store/appReStore.js'
	const idStore = selPersonStore()
let personList = reactive([])
let go = (id) => {
	console.log(id)
	uni.navigateTo({
		url: `/pages/nucleicAcidTesting/ncApplication/ncApplication?id=${id}`
	})
}
// let id=ref()
// id.value=loginStore.id
onMounted(async()=>{
	console.log(idStore.id,23)
	let res = await doctorSelPer(idStore.id)
	console.log(res)
	if (res.data.code == 0) {
		console.log('成功！',res)
		personList.push(...res.data.data)
	}
})
</script>

<style lang="less">
.content {
	margin: 40rpx 30rpx;
	.person {
		margin: 30rpx 0;
		padding: 0 30rpx;
		background-color: #f5f9ff;
		border: 1px solid #f5f5f6;
		border-radius: 10rpx;
		height: 200rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;

		.left {
			display: flex;
			flex-direction: column;
			.data {
				display: flex;
				.name {
					font-size: 30rpx;
					margin-right: 30rpx;
				}
				.tip {
					width: 80rpx;
					height: 40rpx;
					text-align: center;
					line-height: 40rpx;
					font-size: 25rpx;
					background-color: #e2edfe;
					color: #66bdfe;
					border-radius: 30rpx;
				}
			}
			.idcard {
				margin-top: 20rpx;
				color: #bdc7d3;
				font-size: 28rpx;
			}
		}
		.right {
			font-size: 25rpx;
			color: #909495;
		}
	}
}
</style>
